package hys.wwsa.modules.info.controller;

import java.util.Arrays;
import java.util.Map;

import hys.wwsa.modules.info.entity.UcCityEntity;
import hys.wwsa.modules.info.service.UcCityService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import hys.wwsa.common.utils.PageUtils;
import hys.wwsa.common.utils.R;



/**
 * 
 *
 * @author hys
 * @email 2439206957@qq.com
 * @date 2024-02-26 15:21:56
 */
@RestController
@RequestMapping("info/uccity")
public class UcCityController {
    @Autowired
    private UcCityService ucCityService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("info:uccity:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = ucCityService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{ucCityId}")
//    @RequiresPermissions("info:uccity:info")
    public R info(@PathVariable("ucCityId") Integer ucCityId){
		UcCityEntity ucCity = ucCityService.getById(ucCityId);

        return R.ok().put("ucCity", ucCity);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("info:uccity:save")
    public R save(@RequestBody UcCityEntity ucCity){
		ucCityService.save(ucCity);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("info:uccity:update")
    public R update(@RequestBody UcCityEntity ucCity){
		ucCityService.updateById(ucCity);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("info:uccity:delete")
    public R delete(@RequestBody Integer[] ucCityIds){
		ucCityService.removeByIds(Arrays.asList(ucCityIds));

        return R.ok();
    }

}
